package com.yl.users.mapper

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.yl.users.entity.CompanyUser
import com.yl.users.pojo.dto.CompanyPermissionsDto
import com.yl.users.pojo.vo.CompanyUserSelectVo
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param

@Mapper
interface CompanyUserMapper : BaseMapper<CompanyUser> {

	/**
	 * 分页查询
	 */
	fun selectUserPage(
		@Param("page") page: Page<CompanyUser>,
		@Param("vo") vo: CompanyUserSelectVo
	): Page<CompanyUser>

	/**
	 * 分页查询
	 */
	fun selectUserList(
		@Param("vo") vo: CompanyUserSelectVo
	): List<CompanyUser>

	/**
	 * 查询是否有相同的登录名称
	 * @param loginName
	 * @return
	 */
	fun sameUserByLoginName(@Param("loginName") loginName: String): Int




	/**
	 * 查询用户下面是否存在某人
	 * @param userId
	 * @param subId
	 * @return
	 */
	fun selectHaveSubId(
		@Param("userId") userId: Long,
		@Param("subId") subId: Long,
		@Param("companyId") companyId: Long
	): Int

	/**
	 *  获取用户下级
	 */
	fun getSubUserList(@Param("userId") userId: Long,
	                   @Param("companyId") companyId: Long,
	@Param("vo")vo:CompanyUserSelectVo):List<CompanyUser>






}
